home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / acompl1a / frmconfi.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-10-13  |  10.0 KB  |  297 lines

  1. VERSION 5.00
  2. Begin VB.Form frmConfig 
  3.    Caption         =   "Scrolling Credits Setup"
  4.    ClientHeight    =   2520
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   5490
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   2520
  10.    ScaleWidth      =   5490
  11.    StartUpPosition =   2  'CenterScreen
  12.    Begin VB.Frame Frame2 
  13.       Caption         =   "Colour"
  14.       Height          =   2295
  15.       Left            =   2520
  16.       TabIndex        =   10
  17.       Top             =   120
  18.       Width           =   1815
  19.       Begin VB.HScrollBar ColBar 
  20.          Height          =   255
  21.          Index           =   2
  22.          LargeChange     =   30
  23.          Left            =   120
  24.          Max             =   255
  25.          TabIndex        =   13
  26.          Top             =   1680
  27.          Value           =   255
  28.          Width           =   1575
  29.       End
  30.       Begin VB.HScrollBar ColBar 
  31.          Height          =   255
  32.          Index           =   1
  33.          LargeChange     =   30
  34.          Left            =   120
  35.          Max             =   255
  36.          TabIndex        =   12
  37.          Top             =   1080
  38.          Value           =   255
  39.          Width           =   1575
  40.       End
  41.       Begin VB.HScrollBar ColBar 
  42.          Height          =   255
  43.          Index           =   0
  44.          LargeChange     =   30
  45.          Left            =   120
  46.          Max             =   255
  47.          TabIndex        =   11
  48.          Top             =   480
  49.          Value           =   255
  50.          Width           =   1575
  51.       End
  52.       Begin VB.Label lblColor 
  53.          BackColor       =   &H00FFFFFF&
  54.          BorderStyle     =   1  'Fixed Single
  55.          Height          =   135
  56.          Left            =   120
  57.          TabIndex        =   17
  58.          Top             =   2040
  59.          Width           =   1575
  60.       End
  61.       Begin VB.Label Label3 
  62.          Alignment       =   2  'Center
  63.          Caption         =   "Blue"
  64.          Height          =   195
  65.          Left            =   660
  66.          TabIndex        =   16
  67.          Top             =   1440
  68.          Width           =   495
  69.       End
  70.       Begin VB.Label Label2 
  71.          Alignment       =   2  'Center
  72.          Caption         =   "Green"
  73.          Height          =   195
  74.          Left            =   660
  75.          TabIndex        =   15
  76.          Top             =   840
  77.          Width           =   495
  78.       End
  79.       Begin VB.Label Label1 
  80.          Alignment       =   2  'Center
  81.          Caption         =   "Red"
  82.          Height          =   195
  83.          Left            =   660
  84.          TabIndex        =   14
  85.          Top             =   240
  86.          Width           =   495
  87.       End
  88.    End
  89.    Begin VB.CommandButton cmdCancel 
  90.       Caption         =   "Cancel"
  91.       Height          =   375
  92.       Left            =   4440
  93.       TabIndex        =   9
  94.       Top             =   720
  95.       Width           =   975
  96.    End
  97.    Begin VB.CommandButton cmdOK 
  98.       Caption         =   "OK"
  99.       Height          =   375
  100.       Left            =   4440
  101.       TabIndex        =   8
  102.       Top             =   240
  103.       Width           =   975
  104.    End
  105.    Begin VB.Frame Frame1 
  106.       Caption         =   "Text"
  107.       Height          =   2295
  108.       Left            =   120
  109.       TabIndex        =   0
  110.       Top             =   120
  111.       Width           =   2175
  112.       Begin VB.TextBox txtText 
  113.          Height          =   285
  114.          Index           =   6
  115.          Left            =   120
  116.          TabIndex        =   7
  117.          Text            =   "http://www.dirtrider.net/freeride"
  118.          Top             =   1800
  119.          Width           =   1935
  120.       End
  121.       Begin VB.TextBox txtText 
  122.          Height          =   285
  123.          Index           =   5
  124.          Left            =   120
  125.          TabIndex        =   6
  126.          Text            =   "For Motocross visit"
  127.          Top             =   1560
  128.          Width           =   1935
  129.       End
  130.       Begin VB.TextBox txtText 
  131.          Height          =   285
  132.          Index           =   4
  133.          Left            =   120
  134.          TabIndex        =   5
  135.          Text            =   "http://www.parkstonemot.freeserve.co.uk"
  136.          Top             =   1320
  137.          Width           =   1935
  138.       End
  139.       Begin VB.TextBox txtText 
  140.          Height          =   285
  141.          Index           =   3
  142.          Left            =   120
  143.          TabIndex        =   4
  144.          Text            =   "For a free game made in VB visit"
  145.          Top             =   1080
  146.          Width           =   1935
  147.       End
  148.       Begin VB.TextBox txtText 
  149.          Height          =   285
  150.          Index           =   2
  151.          Left            =   120
  152.          TabIndex        =   3
  153.          Text            =   "Screen Saver"
  154.          Top             =   840
  155.          Width           =   1935
  156.       End
  157.       Begin VB.TextBox txtText 
  158.          Height          =   285
  159.          Index           =   1
  160.          Left            =   120
  161.          TabIndex        =   2
  162.          Text            =   "Scrolling Credits"
  163.          Top             =   600
  164.          Width           =   1935
  165.       End
  166.       Begin VB.TextBox txtText 
  167.          Height          =   285
  168.          Index           =   0
  169.          Left            =   120
  170.          TabIndex        =   1
  171.          Text            =   "Carls"
  172.          Top             =   360
  173.          Width           =   1935
  174.       End
  175.    End
  176. Attribute VB_Name = "frmConfig"
  177. Attribute VB_GlobalNameSpace = False
  178. Attribute VB_Creatable = False
  179. Attribute VB_PredeclaredId = True
  180. Attribute VB_Exposed = False
  181. Private Sub cmdCancel_Click()
  182. ' Unload the form if cancel is pressed
  183.     Unload Me
  184. End Sub
  185. Private Sub cmdOK_Click()
  186. ' If OK is pressed then set the values
  187. For i = 0 To NumLines
  188.     CreditText(i) = frmConfig.txtText(i).Text   ' Set the text used
  189. Next i
  190. Colo.R = ColBar(0).Value ' Set the RGB colours
  191. Colo.G = ColBar(1).Value
  192. Colo.B = ColBar(2).Value
  193. 'Read File then change it
  194.     Open "c:\Windows\Control.ini" For Input As #1
  195.         Open "c:\Windows\ControlTemp.tmp" For Output As #2  'Open temporary File
  196.         
  197.         INIFound = False
  198.         
  199.         Do While Not EOF(1)     'Loop until End of file
  200.             Line Input #1, temp 'Store data in temp
  201.             
  202.                 If temp = "[Screen Saver.CarlsCredits]" Then    'First Line of Screen Saver settings
  203.                     For i = 0 To 10
  204.                     Line Input #1, temp 'Just read the lines to stop them being read later
  205.                     Next i
  206.                     
  207.                     Print #2, "[Screen Saver.CarlsCredits]" 'Write Data to temporary file
  208.                     
  209.                     For i = 0 To 6
  210.                     Print #2, CreditText(i) 'Write Text Data to temporary file
  211.                     Next i
  212.                     
  213.                     Print #2, Format(Colo.R) 'Write Color Data to temporary file
  214.                     Print #2, Format(Colo.G)
  215.                     Print #2, Format(Colo.B)
  216.                     INIFound = True 'Settings were found
  217.                 End If
  218.                 
  219.                 
  220.             Print #2, temp  'Copy data from temp (Original data) into temporary file
  221.         Loop
  222.         
  223.         ' If Settings isn't found
  224.         If INIFound = False Then
  225.             Print #2, ""
  226.             Print #2, "[Screen Saver.CarlsCredits]" 'Write data to temporary file
  227.                     
  228.             For i = 0 To 6
  229.                 Print #2, CreditText(i)
  230.             Next i
  231.                     
  232.             Print #2, Format(Colo.R)
  233.             Print #2, Format(Colo.G)
  234.             Print #2, Format(Colo.B)
  235.             Print #2, ""
  236.         End If
  237.         
  238.         Close #2    'Close files
  239.     Close #1
  240.     Kill "c:\Windows\Control.ini"   'Delete original File
  241.     Name "c:\Windows\ControlTemp.tmp" As "c:\Windows\Control.ini"   'Rename temporary file to original name
  242.     'Unload the form
  243.     Unload Me
  244. End Sub
  245. 'If the Scroll bars change then update colour
  246. Private Sub ColBar_Change(Index As Integer)
  247.     lblColor.BackColor = RGB(ColBar(0).Value, ColBar(1).Value, ColBar(2).Value)
  248. End Sub
  249. Private Sub ColBar_Scroll(Index As Integer)
  250.     lblColor.BackColor = RGB(ColBar(0).Value, ColBar(1).Value, ColBar(2).Value)
  251. End Sub
  252. Private Sub Form_Load()
  253. ' Get information
  254.     Open "c:\Windows\Control.ini" For Input As #1
  255.     INIFound = False
  256.     Do While Not EOF(1)
  257.         Line Input #1, temp 'Put data into temp
  258.         If temp = "[Screen Saver.CarlsCredits]" Then    'Start of settings found
  259.             INIFound = True
  260.             
  261.             '10 lines to read
  262.             For i = 0 To 6
  263.                 Line Input #1, CreditText(i)    'Read the text
  264.             Next i
  265.             Line Input #1, temp 'Read colours
  266.             Colo.R = Val(temp)  'Put colours into variable
  267.             Line Input #1, temp
  268.             Colo.G = Val(temp)
  269.             Line Input #1, temp
  270.             Colo.B = Val(temp)
  271.             
  272.             Exit Do 'Exit DO LOOP if settings are found
  273.         End If
  274.     Loop
  275.     Close #1    'Close file
  276. ' If settings isn't found
  277. If INIFound = False Then
  278.     CreditText(0) = "Carls" 'Set Default Values
  279.     CreditText(1) = "Scrolling Credits" 'Set Default Values
  280.     CreditText(2) = "Screen Saver" 'Set Default Values
  281.     CreditText(3) = "For a free game made in VB visit" 'Set Default Values
  282.     CreditText(4) = "http://www.parkstonemot.freeserve.co.uk" 'Set Default Values
  283.     CreditText(5) = "For Motocross visit" 'Set Default Values
  284.     CreditText(6) = "http://www.dirtrider.net/freeride" 'Set Default Values
  285.     Colo.R = 255 'Set Default Values
  286.     Colo.G = 125 'Set Default Values
  287.     Colo.B = 80 'Set Default Values
  288. End If
  289. 'Set text boxes with correct text
  290. For i = 0 To 6
  291.     frmConfig.txtText(i).Text = CreditText(i)
  292. Next i
  293. ColBar(0).Value = Colo.R 'Set scroll bars with correct value
  294. ColBar(1).Value = Colo.G
  295. ColBar(2).Value = Colo.B
  296. End Sub
  297.